<script setup>
const props = defineProps({
  stats: { type: Array, required: true }
})
</script>
<template>
  <el-row :gutter="24" class="dashboard-stats">
    <el-col :span="6" v-for="item in stats" :key="item.title">
      <el-card shadow="never" class="stat-card">
        <div class="stat-title">{{ item.title }}</div>
        <div class="stat-row">
          <div class="stat-info">
            <div class="stat-value">{{ item.value }}</div>
            <div class="stat-sub">{{ item.subTitle }} {{ item.subValue }}</div>
          </div>
          <div class="stat-icon-img" :style="{background: item.iconBg || '#f5f7fa'}">
            <i :class="item.icon" :style="{color: item.iconColor}"></i>
          </div>
        </div>
      </el-card>
    </el-col>
  </el-row>
</template>
<style scoped>
.dashboard-stats {
  margin-bottom: 24px;
}
.stat-card {
  border-radius: 18px;
  background: #fff;
  border: 1px solid #f0f0f0;
  min-height: 170px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
}
.stat-title {
  text-align: left;
  font-size: 22px;
  font-weight: 700;
  color: #222;
  margin-bottom: 10px;
  letter-spacing: 1px;
}
.stat-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}
.stat-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex: 1;
  padding-right: 12px;
}
.stat-value {
  font-size: 22px;
  color: #222;
  text-align: right;
  margin-bottom: 15px;
  line-height: 1.1;
}
.stat-sub {
  color: #68696a;
  font-size: 15px;
  text-align: right;
  font-weight: 500;
}
.stat-icon-img {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 36px;
  box-shadow: 0 2px 12px 0 rgba(0,0,0,0.06);
  flex-shrink: 0;
}
.stat-icon-img i {
  font-size: 34px;
}
</style>